# -*- coding: UTF-8 -*-
# @description : python
# @Author : zyl
# @Time : 2021/9/7 10:47
# @Remark: 视频监控组模型
from pydantic import constr, validator, BaseModel
from model.public.base import MxBaseModel
from utils.parser.fields import check_ipv4


# class MonitorConfigBaseModel(BaseModel):
#     # 序号
#     MonitorNumber: int
#     # rtsp端口
#     RtspPort: int


class MonitorConfigModel(MxBaseModel):
    """
    视频监控模型
    """
    # 监控名称
    MonitorName: constr(min_length=1, max_length=50) = ''
    # 序号
    MonitorNumber: int
    # 用户名
    UserName: str = ''
    # 密码
    pwd: str = ''
    # 摄像头IP
    CameraIp: str
    # 端口号
    # Port: int
    # rtsp端口
    RtspPort: int
    # 通道号
    ChannelNumber: constr(min_length=1, max_length=50) = ''
    # 摄像头方位
    CameraPosition: str = ''
    # 组
    GroupId: int
    # 是否导入
    is_import: constr(min_length=1, max_length=50) = ''
    # 服务器IP
    server_ip: str

    _CameraIp = validator('CameraIp', allow_reuse=True)(check_ipv4)
    _server_ip = validator('server_ip', allow_reuse=True)(check_ipv4)
